/* Copyright (c) 2004-2022 peigen.info. All rights reserved. */

package info.peigen.hotpot.common.core.result;

import info.peigen.hotpot.common.core.annotation.Comment;
import info.peigen.hotpot.common.core.result.facade.DtoAble;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

/**
 * <b>(SingleResult)</b>
 *
 * @author Peigen
 * @version 1.0.0
 * @since 2021/4/9
 */
@EqualsAndHashCode(callSuper = true)
@Data
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class SingleResult<T> extends ResultBase implements DtoAble {
    @ApiModelProperty(value = "返回对象", position = 1)
    @Comment("返回对象")
    private T info;

    public void fromSuccess(T info) {
        setInfo(info).setSuccessNotFee();
    }

    public void fromProcessing(T info) {
        setInfo(info).markProcessing();
    }
}